<template>
  <div class="app-container">
    <comprehensive-table
        @selection-change="selectionChange"
        :columns="column" :data="data" @reset="reset" @onSubmit="onSubmit">
      <template v-slot:btn>
		<div style="display: flex;justify-content: flex-end">
		</div>
      </template>
    </comprehensive-table>
  </div>
</template>
<script>
	var dayjs = require('dayjs')
	import axios from 'axios';
	import ComprehensiveTable from './components/comprehensive.vue'
 
	const column = [
		{ 
			type:'selection', 
			width:60 ,
		},
		{
			name: 'commodityId', 
			label: '商品id',
			inSearch:true,
			valueType:'input',
			width:80, 
		},
		{
			name:'userId', 
			label: '用户Id',
			inSearch:true,
			valueType:'input',	
			width:160,
		},
		{
			name:'id', 
			label: '订单编号',
			inSearch:true,
			valueType:'input',	
			width:160,
		},
		{
			name:'name', 
			label: '商品描述',
			valueType:'input',	
			width:160,
		},
		{
			name:'images', 
			label: '商品图片',	
			valueType:'image',	
			width:160,
		},
		{ 
			name:'stateId', 
			label: '订单状态',
			sorter:true, 
			valueType:'input',
			width:160 ,
		},
		{
			name:'addressId', 
			label: '收货地址',
			valueType:'input',	
			width:160,
		},
		{ 
			name: 'createTime', 
			label: '下单时间',
			sorter:true, 
			valueType:'input',
			width:160 ,
		},
		{ 
			name: 'modifyTime', 
			label: '完成时间',
			sorter:true, 
			valueType:'input',
			width:160 ,
		},
		{ 
			name: 'operation',
			slot:true,
			fixed:'right',
			width:200 ,
		}
  ]
  export default {
    components:{
      ComprehensiveTable
    },
    data(){
      return{
        data:[],
        column,
        rowObj:{},
        selectObj:[],
      }
    },
    methods:{
      selectionChange(val){
        this.selectObj = val
      },
      reset(){
        this.$message.success('触发重置方法')
      },
      onSubmit() {
           // 根据用户ID、商品ID和订单编号发送查询请求
           axios
		   .get('http://43.136.172.73/api/v1/order/transport', {
			   headers:{
				   'Authorization': 'sfsdf' // 设置认证token
			   }
             })
             .then(response => {
               // 处理查询结果
               this.data = response.data;
             })
             .catch(error => {
               // 处理错误
               console.error(error);
             });
         }
       },
       mounted() {
         // 在组件挂载完成后，发送请求获取数据
         axios
           .get('http://43.136.172.73/api/v1/order/transport',{
			   headers:{
				   'Authorization': 'sfsdf' // 设置认证token
			   }
		   })
           .then(response => {
             // 处理请求结果
             this.data = response.data;
			 console.log('33:',this.data)
           })
           .catch(error => {
             // 处理错误
             console.error(error);
           });
       }
     };
</script>
<style scoped>
.edit-input {
  padding-right: 100px;
}
.cancel-btn {
  position: absolute;
  right: 15px;
  top: 10px;
}
</style>
